// JavaScript Document


//jQuery("input[type=checkbox]").on( "click",changemiles);
function changemiles(check)
{	
	if(check == '1'){
		 //alert('AAAAAAaa'+check);
		// lua chon don vi miles
                mile25  = parseFloat(25/1.069,4).toFixed(1);
                mile50  = parseFloat(50/1.069,4).toFixed(1);
                mile100 = parseFloat(100/1.069,4).toFixed(1);
                mile200 = parseFloat(200/1.069,4).toFixed(1);
		         mile300 = parseFloat(250/1.069,4).toFixed(1);
		 
		 
                
		jQuery('#distance').html('<option value="'+mile50+'">' +mile50+' miles</option>'+
                                    '<option value="'+mile100+'">'+mile100+' miles</option>'+
                                    '<option value="'+mile200+'">'+mile200+' miles</option>'+
                                    '<option value="'+mile300+'">'+mile300+' miles</option>'
                                    );
	}
	else{
		
		jQuery('#distance').html('<option value="'+50+'">'+50+' kilometers</option>'+
                                    '<option value="'+100+'">'+100+' kilometers</option>'+
                                    '<option value="'+200+'">'+200+' kilometers</option>'+
                                    '<option value="'+300+'">'+300+' kilometers</option>');
	}
	
        
}
/**
 *  get function when lick ' email  location  to your email'
 *  @param {int} id 

 */
function submitsendmail(id)
{
   var type_user = jQuery('#type_user').val();
   var site_url = jQuery('#site_url').val();
   var url_ajax = site_url+'/wp-content/themes/gorave/ajax/send_email_location.php';
   if(type_user == "")
   {
          jQuery('#send-demo-location-false').modal();
       
   }
   else
   {
        //alert('OK');
         var namecompany = jQuery("#company_name"+id).val();
         var address = jQuery('#address'+id).val();
         var stateProvince = jQuery('#sate_province'+id).val();
         var country = jQuery('#country'+id).val();
         var postcode = jQuery('#postcode'+id).val();
         
         $.post(url_ajax, {sendemaillocation: 1,namecompany:namecompany,address:address,stateProvince:stateProvince,country:country,postcode:postcode}, function(data) {
             
              // jQuery('#tam').html(data);
              jQuery('#send-demo-location-success').modal();
             
         });

        
   }
}
